package components {
import flash.text.TextField;


public class VerticalLayout {
    private var _objects:Array;

    public function VerticalLayout() {
        _objects = new Array();
    }

    public function add(obj:Object):VerticalLayout
    {
        _objects.push(obj);
        return this;
    }

    private function getTextfieldHeight(tf:TextField):int
    {
        var height:Number = 0.0;
            height+=tf.textHeight;
        return height;
    }

    public function repos():void
    {
        var y:int=0;
        var obj:Object;
        var height:Number;
        for each (obj in _objects)
        {
            obj.y = y;

            if (obj is TextField)
            {

                var text:TextField = obj as TextField;
                height = text.textHeight;

            }else{
                height = obj.height;
            }
            y += height;
        }
    }
}
}
